#include<fstream>打开输入文件

来源:百度知道 编辑:UC知道 时间:2024/07/11 03:16:45
#include<fstream>
using namespace std;
int main()
{ifstream ins;
ins.open("D:\Program Files\Microsoft Visual Studio\sue\sue.dat");
ins.close();
return 0;
}
======================这是程序
=========================================================
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0xD1C has exited with code 0 (0x0).
The program 'D:\Program Files\Microsoft Visual Studio\game\Debug\Cpp1.exe' has exited with code 0 (0x0).
======================这是DEBUG

为什么会这样呢?我想要用 ifstream 创个文件 以后好练习读取。。
大家来帮我看看。。

"D:\\Program Files\\Microsoft Visual Studio\\sue\\sue.dat";

这里都要用\\来代替\,因为\是段落连接号,用来连接上下行语句的

#include <iostream.h>才对

这有什么不正常啊,MFC中常用CFile类来读写文件

你没设断点而已,程序正常退出。

#include<iostream.h>是老的写法,淘汰。